<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>上传</title>

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/datepicker3.css" rel="stylesheet">
<link href="css/styles.css" rel="stylesheet">

</head>
<body>
	<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
		<div class="container-fluid">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#sidebar-collapse">
					<span class="sr-only">Toggle navigation</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="#"><span>Web</span>Listen</a>
				<ul class="user-menu btn-lg">
                    <li class="dropdown pull-right">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-th"></span> <span class="caret"></span></a>
                        <ul class="dropdown-menu" role="menu">
                            <li><a href="player.html"><span class="glyphicon glyphicon-headphones"></span>本地音乐</a></li>
                            <li><a href="search.html"><span class="glyphicon glyphicon-cloud"></span> 在线音乐</a></li>
                            <li><a href="add.html"><span class="glyphicon glyphicon-log-out"></span> 分享</a></li>
                        </ul>
                    </li>
                </ul>
			</div>
							
		</div><!-- /.container-fluid -->
	</nav>				
		
		<div class="row">
			<div class="col-lg-12">
				<div class="panel panel-default">
					<div class="panel-heading"><h2>音乐上传</h2></div>
					<div class="panel-body">
						<div class="col-md-6">
							<form role="form" action="cgi-bin/add.cgi" method="post" enctype="multipart/form-data" target="_blank" id="form1">
							
								<div class="form-group">
									<label>名称</label>
									<input name="name" class="form-control" id="name_txt">
								</div>
																
								<div class="form-group">
									<label>专辑</label>
									<input name="ZJ" class="form-control" id="ZJ_txt">
								</div>
								
								<div class="form-group">
									<label>演唱者</label>
									<input name="player" class="form-control" id="player_txt">
								</div>
																
								<div class="form-group">
									<label>文件路径</label>
									<input type="file" name="file" id="path_txt">
								</div>
							</div>
							<div class="col-md-6">
								
								<div class="form-group">
									<label>播放权限</label>
									<div class="radio">
										<label>
											<input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked>仅我一人可见
										</label>
									</div>
									<div class="radio">
										<label>
											<input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">好友可见
										</label>
									</div>
									<div class="radio">
										<label>
											<input type="radio" name="optionsRadios" id="optionsRadios3" value="option3">共享
										</label>
									</div>
									<div class="radio">
										<label>
											<input type="radio" name="optionsRadios" id="optionsRadios3" value="option3">有偿
										</label>
									</div>
								</div>
								
								<div class="form-group">
									<label>流派</label>
									<select class="form-control">
										<option>古典</option>
										<option>流行</option>
										<option>爵士</option>
										<option>DJ</option>
								 	</select>
								</div>
								<div class="progress">
								   <div class="progress-bar" role="progressbar" aria-valuenow="0" 
								      aria-valuemin="0" aria-valuemax="100" style="width: 40%;">
								      <span class="sr-only"></span>
								   </div>
								</div>
								<button type='button' class="btn btn-primary" onclick="update()">确认提交</button>
								<button type='button' class="btn btn-default">重新添加</button>
							</div>
						</form>
					</div>
				</div>

			</div><!-- /.col-->

	<script src="js/jquery-1.11.1.min.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/chart.min.js"></script>
	<script src="js/chart-data.js"></script>
	<script src="js/easypiechart.js"></script>
	<script src="js/easypiechart-data.js"></script>
	<script src="js/bootstrap-datepicker.js"></script>
	<script>
			function update(){
			if($('#name_txt').val() == ""){
		    return false;
		  }
		  if($('#player_txt').val() == ""){
		    return false;
		  }
		  if($('#path_txt').val() == ""){
		    return false;
		  }
		  ajax_post();
		}

		function ajax_post(){
		 /* $.post("cgi-bin/add.cgi",{name:$('#name_txt').val(),palyer:$('#player_txt').val(),path:$('#path_txt').val()},
		  function(data){
		    alert(data);
		  });*///这里返回的类型有：json,html,xml,text
		  document.getElementById("form1").submit();
		}
		!function ($) {
			$(document).on("click","ul.nav li.parent > a > span.icon", function(){		  
				$(this).find('em:first').toggleClass("glyphicon-minus");	  
			}); 
			$(".sidebar span.icon").find('em:first').addClass("glyphicon-plus");
		}(window.jQuery);

		$(window).on('resize', function () {
		  if ($(window).width() > 768) $('#sidebar-collapse').collapse('show')
		})
		$(window).on('resize', function () {
		  if ($(window).width() <= 767) $('#sidebar-collapse').collapse('hide')
		})
	</script>	
</body>

</html>
